import { useI18n } from '/@/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '/@/components/Table';
import { shopProductClsListData } from '/@/api/shop/product/shopProductCls';

const { t } = useI18n('sys.empUser');

const modalProps = {
  title: t('产品系列选择'),
};

const searchForm: FormProps = {
  baseColProps: { lg: 6, md: 8 },
  labelWidth: 80,
  schemas: [
    {
      label: t('系列编码'),
      field: 'code',
      component: 'Input',
    },
    {
      label: t('系列名称'),
      field: 'name',
      component: 'Input',
    },
  ],
};

const tableColumns: BasicColumn[] = [
  {
    title: t('系列编码'),
    dataIndex: 'code',
    key: 'a.code',
    sorter: true,
    width: 120,
    align: 'left',
    slot: 'firstColumn',
  },
  {
    title: t('系列名称'),
    dataIndex: 'name',
    key: 'a.name',
    sorter: true,
    width: 120,
    align: 'left',
  },
  {
    title: t('发布APP'),
    dataIndex: 'bappShow',
    key: 'a.bapp_show',
    sorter: true,
    width: 120,
    align: 'center',
    dictType: 'sys_yes_no',
  },
  {
    title: t('APP图片路径'),
    dataIndex: 'picUrl',
    key: 'a.pic_url',
    sorter: true,
    width: 380,
    align: 'left',
  },
  {
    title: t('状态'),
    dataIndex: 'status',
    key: 'a.status',
    sorter: true,
    width: 130,
    align: 'center',
    dictType: 'sys_search_status',
  },
  {
    title: t('更新时间'),
    dataIndex: 'updateDate',
    key: 'a.update_date',
    sorter: true,
    width: 150,
    align: 'left',
  },
  {
    title: t('备注信息'),
    dataIndex: 'remarks',
    key: 'a.remarks',
    sorter: true,
    width: 150,
    align: 'left',
  },
  {
    title: t('顺序号'),
    dataIndex: 'treeSort',
    key: 'a.tree_sort',
    sorter: true,
    width: 130,
    align: 'center',
  },
  
];

const tableProps: BasicTableProps = {
  api: shopProductClsListData,
  beforeFetch: (params) => {
    params['isAll'] = true;
    params['ope'] = '1'
    return params;
  },
  columns: tableColumns,
  formConfig: searchForm,
  rowKey: 'id',
};

export default {
  modalProps,
  tableProps,
  itemCode: 'id',
  itemName: 'name',
};
